#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

class Solution{
    public:
    // 超出长度
    int ans1(int n){
        long long fac = factorial(n);
        int tail, count = 0;
        while(fac > 0){
            tail = fac % 10;
            fac = fac / 10;
            if(tail == 0){
                count++;
            }else{
                break;
            }
        }
        return count;
    }
    long long factorial(int n){
        long long ret = 1;
        for(int i = 1; i != n+1; i++){
            ret = ret * i;
        }
        return ret;
    }

    int ans2(int n){
        int counts = 0;
        for(int i = 5; i <= n; i = i + 5){
            int x = i;
            while(true){
                if(x % 5 == 0){
                    x = x / 5;
                    counts++;
                }else{
                    break;
                }
            }
        }
        return counts;
    }
};

void test1(){
    Solution s;
    int n = 30;
    int ret = s.ans2(n);
    cout << ret << endl;
}

void test2(){
    Solution s;
    int n = 5;
    int ret = s.ans2(n);
    cout << ret << endl;
}

int main(void){
    test1();
    test2();

    return 0;
}